package com.juc.learn.CustomCommunications;

/**
 * ClassName:TestShareResource
 * Package:com.juc.learn.CustomCommunications
 * Description:
 *
 * @Author:@郭先森
 * @Create:2025/7/26 - 17:58
 * @Version:v1.0
 */
public class TestShareResource {
    public static void main(String[] args) {
        ShareResource resource = new ShareResource();

        new Thread(()->{
            try {
                for (int i = 0; i < 15; i++) {
                    resource.printThreadA(5);
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        },"AA").start();

        new Thread(()->{
            try {
                for (int i = 0; i < 15; i++) {
                    resource.printThreadB(10);
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        },"BB").start();

        new Thread(()->{
            try {
                for (int i = 0; i < 15; i++) {
                    resource.printThreadC(5);
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        },"CC").start();

    }
}
